<?php

Raise::load('core.helper.convert.RaiseUnitConverter');

/**
 * RaiseLengthConverter class
 * for conversion between length units
 * 
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core.helper.convert.unit
 * @since 1.2
 */
class RaiseLengthConverter extends RaiseUnitConverter {
    
    /**
     * Centimetre unit
     */
    const CENTIMETRE = 0.01;
    
    /**
     * Decimetre unit
     */
    const DECIMETRE = 0.1;
    
    /**
     * Metre unit
     */
    const METRE = 1;
    
    /**
     * Millimetre unit
     */
    const MILLIMETRE = 0.001;
    
    /**
     * Kilometre unit
     */
    const KILOMETRE = 1000;
    
    /**
     * Inch unit
     */
    const INCH = 0.0254;
    
    /**
     * Foot unit 
     */
    const FOOT = 0.3048;
    
    /**
     * Yard unit 
     */
    const YARD = 0.9144;
    
    /**
     * Chain unit 
     */
    const CHAIN = 20.1168;
    
    /**
     * Furlong unit 
     */
    const FURLONG = 201.168;
    
    /**
     * Mile unit 
     */
    const MILE = 1609.344;
    
    /**
     * League unit 
     */
    const LEAGUE = 4828.032;
    
    /**
     * Nautical Mile unit 
     */
    const NAUTICAL_MILE = 1853.184;
    
    /**
     * Convert the subject between number bases
     * @param integer|double $subject
     * @return double
     */
    public function convert($subject) {
        $value = $subject;
        $value *= $this->from();
        $value /= $this->to();
        return $value;
    }
    
}